#  Copyright (C) Benjamin Kalish 2010
#  
#  This program is free software; you can redistribute it and/or
#  modify it under the terms of the GNU General Public License
#  as published by the Free Software Foundation; either version 2
#  of the License, or (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.

from latex_converter import LatexConverter

class Latex2UnicodeConverter( LatexConverter ):
    def double_left_quote(self):
        return unichr(8220)
    
    def double_right_quote(self):
        return unichr(8211)

    def em_dash(self):
        return unichr(8212)

    def en_dash(self):
        return unichr(8211)
    
    def inverted_question_mark(self):
        return unichr(191)
   
    def inverted_exclamation_mark(self):
        return unichr(161)
    
    def nonbreaking_space(self):
        return unichr(160)
    
    def paragraph_break(self):
        return '\r'
        
    def acute(self, arg):
        return arg + u"\u0301"
    
    def aleph(self):
        return u"\u2135"
    
    def ampersand(self):
        return '&'

    def breve(self, arg):
        return arg + unichr(774)
        
    def capital_l_with_stroke(self):
        return u"\u0141"

    def capital_thorn(self):
        return u"\u00DE"

    def caron(self, arg):
        return arg + u"\u030C"

    def cedilla(self, arg):
        return arg + u"\u0327"

    def circumflex(self, arg):
        return arg + u"\u0302"

    def cyrillic_soft_sign(self):
        return u"\u044C"

    def cyrillic_hard_sign(self):
        return u"\u044A"

    def dollar_sign(self):
        return '$'

    def dot_above(self, arg):
        return arg + u"\u0307"

    def dot_below(self, arg):
        return arg + u"\u0323"

    def double_acute(self, arg):
        return arg + u"\u030B"
    
    def element_of(self):
        return u"\u2208"

    def eszett(self):
        return u"\u00DF"
        
    def eth(self):
        return u"\u00F0"

    def grave(self, arg):
        return arg + u"\u0300"

    def low_line(self, arg):
        return arg + u"\u0332"

    def macron(self, arg):
        return arg + u"\u0304"

    def partial(self):
        return u"\u2202"
        
    def plus_or_minus(self):
        return u"\u00B1"

    def ring_above(self, arg):
        return arg + u"\u030A"

    def small_l_with_stroke(self):
        return u"\u0142"

    def small_thorn(self):
        return u"\u00FE"
    
    def square_root(self, arg):
        return u"\u221A(" + arg + ")"

    def sterling(self):
        return u"\u00A3"
    
    def subscript(self, arg):
        if arg == '2': # use unicode subscript 2
            return u"\u2082"
        # There are many more such subscripts. Should we use them?
        return '_(' + arg + ')'

    def superscript(self, arg):
        if arg == '2': # use unicode superscript 2
            return u"\u00B2"
        if arg == '3': # use unicode superscript 3
            return u"\u00B3"
        # There are many more such superscripts. Should we use them?
        return '^(' + arg + ')'

    def tilde(self, arg):
        return arg + u"\u0303"

    def umlaut(self, arg):
        return arg + unichr(776)

    def small_alpha(self):
        return u"\u03B1"

    def small_beta(self):
        return u"\u03B2"
        
    def small_gamma(self):
        return u"\u03B3"

    def small_delta(self):
        return u"\u03B4"

    def small_epsilon(self):
        return u"\u03B5"

    def small_zeta(self):
        return u"\u03B6"
        
    def small_eta(self):
        return u"\u03B7"
        
    def small_theta(self):
        return u"\u03B8"

    def small_iota(self):
        return u"\u03B9"

    def small_kappa(self):
        return u"\u03BA"

    def small_lambda(self):
        return u"\u03BB"

    def small_mu(self):
        return u"\u03BC"

    def small_nu(self):
        return u"\u03BD"

    def small_xi(self):
        return u"\u03BE"

    def small_omicron(self):
        return u"\u03BF"

    def small_pi(self):
        return u"\u03C0"

    def small_rho(self):
        return u"\u03C1"

    def small_sigma(self):
        return u"\u03C3"

    def small_tau(self):
        return u"\u03C4"

    def small_upsilon(self):
        return u"\u03C5"

    def small_phi(self):
        return u"\u03C6"

    def small_chi(self):
        return u"\u03C7"

    def small_psi(self):
        return u"\u03C8"

    def small_omega(self):
        return u"\u03C9"

    def capital_alpha(self):
        return u"\u0391"

    def capital_beta(self):
        return u"\u0392"

    def capital_gamma(self):
        return u"\u0393"

    def capital_delta(self):
        return u"\u0394"

    def capital_epsilon(self):
        return u"\u0395"

    def capital_zeta(self):
        return u"\u0396"

    def capital_eta(self):
        return u"\u0397"

    def capital_theta(self):
        return u"\u03F4"

    def capital_iota(self):
        return u"\u0399"

    def capital_kappa(self):
        return u"\u039A"

    def capital_lambda(self):
        return u"\u039B"

    def capital_mu(self):
        return u"\u039C"

    def capital_nu(self):
        return u"\u039D"

    def capital_xi(self):
        return u"\u039E"

    def capital_omicron(self):
        return u"\u039F"

    def capital_pi(self):
        return u"\u03A0"

    def capital_rho(self):
        return u"\u03A1"

    def capital_sigma(self):
        return u"\u03A3"

    def capital_tau(self):
        return u"\u03A4"

    def capital_upsilon(self):
        return u"\u03A5"

    def capital_phi(self):
        return u"\u03A6"

    def capital_chi(self):
        return u"\u03A7"

    def capital_psi(self):
        return u"\u03A8"

    def capital_omega(self):
        return u"\u03A9"
        
    def small_o_slash(self):
        return u"\u00F8"
        
    def captial_o_slash(self):
        return u"\u00D8"